﻿using Microsoft.EntityFrameworkCore;
using System;
using Domin;
using Pomelo.EntityFrameworkCore.MySql;
using Helps;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;

namespace EF_Cord
{
    public class SDBCountext : DbContext
    {
        public SDBCountext(DbContextOptions options) : base(options) { }
        protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
        {
            string connstr = AppConfigurtaionServices.Configuration.GetConnectionString("Sql");
            optionsBuilder.UseSqlServer(connstr);
            ILoggerFactory myloggerFactory = LoggerFactory.Create(builder => { builder.AddConsole(); });
            optionsBuilder.UseLoggerFactory(myloggerFactory);
            base.OnConfiguring(optionsBuilder);
        }
        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {

        }
        public DbSet<Peoples> Peoples { get; set; }
        public DbSet<Roles> Roles { get; set; }
        public DbSet<Havs> Havs { get; set; }
        public DbSet<Powers> Powers { get; set; }
        public DbSet<RolePowers> RolePowers { get; set; }
        public DbSet<Mune> Munes { get; set; }
        public DbSet<RoleMune> RoleMune { get; set; }
        public DbSet<Users> Users { get; set; }
    }
}
